package com.shycloud.mido.organ.api.feign;

import com.shycloud.mido.common.core.constant.SecurityConstants;
import com.shycloud.mido.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.Map;

@FeignClient(value = "shycloud-organ-biz")
public interface RemoteOrganService {

	/**
	 * feign 开通纠错大师
	 *
	 * @param memberId
	 * @param duration
	 * @return com.baomidou.mybatisplus.extension.api.R
	 * @author nianhua.jiang
	 * @date 2020/6/10 15:00
	 */
	@RequestMapping(method = RequestMethod.GET, value = "/master/v2/activateByDuration")
	R<Map> activateByDuration(@RequestParam("memberId") String memberId, @RequestParam("duration") Integer duration);

	/**
	 * feign 开是否是纠错大师
	 *
	 * @param memberId
	 * @return com.baomidou.mybatisplus.extension.api.R
	 * @author nianhua.jiang
	 * @date 2021/05/12
	 */
	@RequestMapping(method = RequestMethod.GET, value = "/master/v2/isMaster")
	R<Map> isMaster(@RequestParam("memberId") String memberId);

	@GetMapping("/master/v2/checkMemberMaster")
	R<Map<String, Object>> checkMemberMaster(@RequestParam("memberId") String memberId);

	@GetMapping("/master/v2/activateByDurationMini")
	R<LocalDateTime> activateByDurationMini(@RequestParam("udid") String udid, @RequestParam("busiType") String busiType,
											@RequestParam("durationType") String durationType, @RequestParam("durationTypeValue") Integer durationTypeValue,
											@RequestParam("remark") String remark, @RequestParam("optId") Integer optId,
											@RequestParam("orgId") Integer orgId, @RequestParam("distId") Integer distId,
											@RequestParam("specialType") Integer specialType);

	@GetMapping("/master/v2/prolongMasterFeign")
	R prolongMasterFeign(@RequestParam("udid") String udid,
						 @RequestParam("duration") Integer duration,
						 @RequestHeader(SecurityConstants.FROM) String from);

	@GetMapping("/master/v2/updPreStorageCount")
	R updPreStorageCount(@RequestParam("orgId") Integer orgId,
						 @RequestParam("preStorageCount") Integer preStorageCount,
						 @RequestHeader(SecurityConstants.FROM) String from);
	
	@GetMapping("/master/v2/checkAndUpdPreStorageCount")
	R checkAndUpdPreStorageCount(@RequestParam("orgId") Integer orgId,
						 @RequestParam("preStorageCount") Integer preStorageCount,
						 @RequestHeader(SecurityConstants.FROM) String from);

}
